package com.example.zz.example.pattern.composite;

import java.util.ArrayList;

/**
 * Describe:
 *
 * @author zhangzhuo18.
 * Date: 2024/6/20
 */
public class Composite implements Component {
    private ArrayList<Component> children = new ArrayList<>();

    public void add(Component component) {
        children.add(component);
    }

    @Override
    public void operation() {
        for (Component child : children) {
            child.operation();
        }
        System.out.println("Composite ");
    }
}
